package yf.mall.dao;

import com.yf.dao.BaseDao;
import yf.mall.entity.UserEntity;
import yf.mall.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 用户Dao
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Tue Aug 27 18:12:02 CST 2019
 */
@Mapper
public interface UserDao extends BaseDao<UserEntity> {
    List<UserVo> queryListVo(UserVo userVo);

    UserVo getVo(Long id);

    UserEntity findByCode(String code);

    UserEntity findByMobile(String mobile);

    List<UserEntity> findByVip(String tCode);

    //通过微信OpenId或者UnionID查找
    UserEntity findByWxId(String wxId);

    //替换团队
    void updateTeam(@Param("oldTCode") String oldTCode,@Param("nowTCode") String nowTCode,@Param("oldTeam" ) String oldTeam, @Param("nowTeam" ) String nowTeam);

    List<UserVo> findByNameOrCodeOrMobile(@Param("param") String param);

    List<UserEntity> findByTop(@Param("userId") Long userId);

    List<UserEntity> findByList(@Param("users") List<UserEntity> users);


    Integer findFansNum(@Param("userId") Long userId, @Param("lv") int lv);

    Integer findAgentNum(@Param("userId") Long userId, @Param("lv") int lv);

    List<UserVo> findByUserId(long userId);


    List<UserVo> findList(@Param("userVos") List<UserVo> userVos);

    Integer sumUserByPidAndLevel(@Param("userId") Long userId, @Param("levelId") Long levelId);

}
